﻿// 功能：Wlan控制API
// 描述：
// 作者：温伟鹏
// 日期：2010/5/12 11:17:01

using System;
using System.Runtime.InteropServices;

namespace MeizuSDK.Core
{
    /// <summary>
    /// Wlan API
    /// </summary>
    public sealed class WlanEnableApi
    {
        /// <summary>
        /// 开关WLAN 注:可以对WLAN进行关闭与打开操作
        /// </summary>
        /// <param name="enable">true，为激活WIFI硬件；false，为关闭WIFI</param>
        /// <returns></returns>
        [DllImport("PlatformAPIWrapper.dll", SetLastError = true, EntryPoint = "EnableMzWIFIEX")]
        public static extern bool EnableMzWIFI(bool enable);
        /// <summary>
        /// WLAN状态通知给shell 注:将Wlan的状态通知给shell，一般在EnableMzWiFI后要跟上此方法.
        /// </summary>
        [DllImport("PlatformAPIWrapper.dll", SetLastError = true, EntryPoint = "ShellPostWlanEx")]
        public static extern void ShellPostWlan();
        /// <summary>
        /// 清未读邮件 这个函数只有在恢复出厂设置的时候才用到
        /// </summary>
        [DllImport("PlatformAPIWrapper.dll", SetLastError = true, EntryPoint = "ResetEmailEx")]
        public static extern void ResetEmail();
        /// <summary>
        /// 判断Wifi是否打开 return true 打开状态，flase 关闭状态 
        /// </summary>
        /// <returns></returns>
        [DllImport("PlatformAPIWrapper.dll", SetLastError = true, EntryPoint = "IsLoadWIFIEx")]
        public static extern bool IsLoadWIFI();
        /// <summary>
        /// 判断本机是否有wifi 返回TRUE表示有，FALSE表示没有。有wifi相关的UI可调用此函数判断
        /// </summary>
        /// <returns></returns>
        [DllImport("PlatformAPIWrapper.dll", SetLastError = true)]
        private static extern bool SettingApiIsWifiAvailable();

        /// <summary>
        /// 获取一个值，指示手机是否存在WIFI设备
        /// </summary>
        public static bool IsWifiAvailable
        {
            get{
                return SettingApiIsWifiAvailable();
            }
        }
    }
}
